{% extends "admin/base_site.html" %}
{% load i18n %}

{% block extrahead %}
	<script type="text/javascript" charset="utf-8" src="{{ MEDIA_URL }}scripts/jquery.js"></script>
	<script type="text/javascript" charset="utf-8">

		get_count = function (total) {
			url = location.href+'status/';
			
			$.get(url, function(data){
				var percent = Math.round(1000/total*parseInt(data))/10;
				
				if (percent == 100.0) {
					clearInterval(countUpdaterID);
					$('#update_message').text("Done");
				}
				
				$('#already_imported').text(data);
				$('#percent_imported').text(percent + '%');
			});
		}
		
		var countUpdaterID = 0;
		$(document).ready(function() {
			var total = parseInt($('#total_to_import').text());
			
			countUpdaterID = setInterval("get_count("+total+");", 500);
		});
	</script>
{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href="../../../">{% trans 'Home' %}</a> &rsaquo; 
    <a href="../../">{{app_label|capfirst|escape}}</a> &rsaquo; 
    <a href="../">{{module_name}}</a> &rsaquo; 
    {% blocktrans %}Sincronizza con flickr{% endblocktrans %}
</div>
{% endblock %}

{% block content %}
	<div id="content-main">
		<p><span id="already_imported">0</span> of <span id="total_to_import">{{ total_count }}</span> done (<span id="percent_imported">0%</span>).</p>
		<p id="update_message"></p>
	</div>
{% endblock %}
